package com.zls;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.test.context.junit4.SpringRunner;

@SpringBootTest(classes = RedisApp.class)
@RunWith(SpringRunner.class)
public class test {
    @Autowired
    private RedisTemplate redisTemplate;
    @Test
    public void demo01(){
        redisTemplate.opsForValue().set("redistem","hello");
        String tem = (String) redisTemplate.opsForValue().get("redistem");
        System.out.println(tem);
    }

    @Autowired
    private StringRedisTemplate stringRedisTemplate;
    @Test
    public void demo02(){
        stringRedisTemplate.opsForValue().set("redistems","hello");
        String tem = (String) stringRedisTemplate.opsForValue().get("redistems");
        System.out.println(tem);
    }
}
